/**
 * Created by zheng on 2018/7/2.
 */
$(function () {
    /*$('#dg').datagrid({
        url: 'employee.json',
        fitColumns: true,
        pagination: true,
        toolbar: "#tb",
        // <!-- 斑马线-->
        striped: true,
        // <!-- 显示序号-->
        rownumbers: true,
        //指定只能单行选择
        singleSelect: true,

        pageSize: 10,
        //页数选择
        pageList: [10, 20, 30, 40, 50],
        sortName: "id",
        sortOrder: "desc",

        //在请求远程数据的时候发送额外的参数。

        queryParams: {
            name: 'easyui',
            subject: 'datagrid'
        },


        columns: [[
            {field: 'baseInfo', title: '基本属性', colspan: 2, width: 100, align: "center"},
            {field: 'otherInfo', title: '其他属性', colspan: 3, width: 100, align: "center"}
        ], [
            {field: 'id', title: '编码', width: 100},
            {field: 'name', title: '名称', width: 100},
            {field: 'inputTime', title: '入职时间', width: 100},
            {
                field: 'dept', title: '部门', width: 100,
                formatter: function (value, row, index) {
                    return value ? value.name : "未分配部门";
                }

                /!*, align: 'right'*!/
            },
            {
                field: 'state', title: '状态', width: 100,
                formatter: function (value, row, index) {
                    if (value) {
                        return "在职";
                    } else {
                        return "离职";
                    }
                }
                /!*, align: 'right'*!/
            }
        ]]
    });*/
    // alert(110)
    //系统菜单
    $('#main_tree1').tree({
        url: '/systemMenu/loadMenuByParentSn?parentSn=system',
        cls:"am-icon-table",
        onLoadSuccess:function (node, data) {
            //获取所有的子节点
            var tree=$('#main_tree1').tree("getChildren")
            for(var treeI=0;treeI<tree.length;treeI++){
                //给每一个子节点设置class
                $(tree[treeI].target).addClass("am-icon-table")
                $(tree[treeI].target).addClass("nav-link tpl-left-nav-link-list")
            }
            console.log(tree);
            console.log(node);
            console.log(data);
        },
        onClick: function (node) {
            $("#indexUrl").prop("src",node.url)
        }
    });
    $('#main_tree2').tree({
        url: '/systemMenu/loadMenuByParentSn?parentSn=business',
        onClick: function (node) {
            $("#indexUrl").prop("src",node.url)
        }
    });
    $('#main_tree3').tree({
        url: '/systemMenu/loadMenuByParentSn?parentSn=charts',
        onClick: function (node) {
            $("#indexUrl").prop("src",node.url)
        }
    });




    //
    $('#tt').tabs({
        //边框
        border:false,
        //选项卡间是否有间距
        narrow: false,

        //气泡
        //pill: true,
//                onSelect:function(title){
//                    alert(title+' is selected');
//                }

    });




})
